<extend name="template/base_index" />
<block name="area_header">
    <link rel="stylesheet" href="__CSS__/userinfo.css">

</block>
<block name="area_body">
    <form id="addre_form" method="post" action="{:U('UserCenter/add_addre')}">
        <!--隐藏一个需要跳转的卖商品的ID-->
    <input type="hidden" value="{$product_id}" name="product_id">
        <input type="hidden" value="{$type}" name="type">
    <div class="weui_cells weui_cells_form">
        <div class="weui_cell">
            <div class="weui_cell_hd"><label class="weui_label">收货人</label></div>
            <div class="weui_cell_bd weui_cell_primary">
                <input class="weui_input" name="contactname" type="text" >
            </div>
        </div>
        <div class="weui_cell">
            <div class="weui_cell_hd"><label class="weui_label">联系电话</label></div>
            <div class="weui_cell_bd weui_cell_primary">
                <input class="weui_input" name="mobile" type="tel" >
            </div>
        </div>
        <div class="weui_cell">
            <div class="weui_cell_hd"><label class="weui_label">所在地区</label></div>
            <div class="weui_cell_bd weui_cell_primary">
                <input type="text" id='city-picker' class="weui_input" name="address" placeholder="请选择" />
            </div>
        </div>
        <div class="weui_cell">
            <div class="weui_cell_hd"><label class="weui_label">详细地址</label></div>
            <div class="weui_cell_bd weui_cell_primary">
                <input type="text" id='city-picker' class="weui_input" name="detailinfo" placeholder="请输入" />
            </div>
        </div>
    </div>
    </form>
    <a href="javascript:;" class="weui_btn weui_btn_warn save_button" onclick="validate_form()">保存</a>
    <script src="__JS__/jquery-weui.min.js"></script>
    <script type="text/javascript" src="__JS__/city-picker.min.js" charset="utf-8"></script>
    <script>
        $("#city-picker").cityPicker({
            title: "请选择收货地址"
        });
        //提交前进行表单验证
        function validate_form(){
            if($("[name='contactname']").val() !='' && $("[name='mobile']").val() !='' && $("[name='address']").val() != ''&& $("[name='addre_detail']").val() != ''){
                $('#addre_form').submit();
            }else{
                $.toast('表单填写有误');
            }
        }
    </script>
</block>